package com.zf.seata.seataorder.feign.fallback;

import com.zf.common.core.result.RestResponse;
import com.zf.seata.seataorder.feign.StorageFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 错误回调
 */
@Component
@Slf4j
public class StorageFeignFallbackFactory implements FallbackFactory<StorageFeign> {
    @Override
    public StorageFeign create(Throwable cause) {
        return new StorageFeign() {
            @Override
            public RestResponse<?> changeStorage(Long id, Integer num) throws Throwable {
                log.error("错误：", cause);
                throw cause;
            }
        };
    }
}
